From c2619648bf1ccf5e0ffb9d44015604969c4873d4 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 5 Aug 2016 09:07:18 -0700 Subject: [PATCH] Demote duplicate build target error to a warning Added in #2847 this ended up unfortunately breaking the `regex` crate on nightly, so let's just issue a warning for awhile first. Eventually we can promote this to an error if it becomes a problem. --- src/cargo/util/toml.rs | 3 ++- tests/build.rs | 17 +++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/cargo/util/toml.rs b/src/cargo/util/toml.rs index 43ec13c26..9a7e2135a 100644 --- a/src/cargo/util/toml.rs +++ b/src/cargo/util/toml.rs @@ -536,7 +536,8 @@ impl TomlManifest { } if let Err(e) = unique_build_targets(&targets, layout) { - bail!("duplicate build target found: `{}`", e); + warnings.push(format!("file found to be present in multiple \ + build targets: {}", e)); } let mut deps = Vec::new(); diff --git a/tests/build.rs b/tests/build.rs index 1e85bbf7c..4f74335b8 100644 --- a/tests/build.rs +++ b/tests/build.rs @@ -117,21 +117,18 @@ fn cargo_compile_duplicate_build_targets() { [dependencies] "#) .file("src/main.rs", r#" + #![allow(warnings)] fn main() {} "#); - let error_message = format!("\ -[ERROR] failed to parse manifest at `[..]` - -Caused by: - duplicate build target found: `{}`", - p.root().join("src[..]main.rs").display()); - assert_that(p.cargo_process("build"), execs() - .with_status(101) - .with_stderr(error_message) - ) + .with_status(0) + .with_stderr("\ +warning: file found to be present in multiple build targets: [..]main.rs +[COMPILING] foo v0.0.1 ([..]) +[FINISHED] [..] +")); } #[test] -- 2.30.2